%%%-------------------------------------------------------------------
%%% @author kk
%%% @copyright (C) 2024, <COMPANY>
%%% @doc
%%% 逆转列表或元组
%%% @end
%%% Created : 19. 7月 2024 16:02
%%%-------------------------------------------------------------------
-module(d10).
-author("kk").

%% API
-export([reverse/1]).

%% 逆转列表
reverse([]) -> error;
reverse(List) -> reverse(List, 1, []).
reverse([], Index, Reverse_List) -> Reverse_List;
reverse([H | List], Index, Reverse_List) ->
  New_List = [H | Reverse_List],
  reverse(List, Index + 1, New_List).
